<?php

/**
 * Communication filter form base class.
 *
 * @package    tfe
 * @subpackage filter
 * @author     3emeIG
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseCommunicationFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_contact'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contact'), 'add_empty' => true)),
      'id_groupe'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Groupe'), 'add_empty' => true)),
      'type'        => new sfWidgetFormChoice(array('choices' => array('' => '', 'Téléphone' => 'Téléphone', 'E-mail' => 'E-mail', 'Fax' => 'Fax', 'Courrier' => 'Courrier', 'SMS' => 'SMS', 'Oral' => 'Oral', 'Braille' => 'Braille', 'Signaux de fumée' => 'Signaux de fumée', 'Morse' => 'Morse', 'Uppercut' => 'Uppercut', 'Autre' => 'Autre'))),
      'date'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'objet'       => new sfWidgetFormFilterInput(),
      'commentaire' => new sfWidgetFormFilterInput(),
      'deleted_at'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'created_at'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'id_contact'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Contact'), 'column' => 'id')),
      'id_groupe'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Groupe'), 'column' => 'id')),
      'type'        => new sfValidatorChoice(array('required' => false, 'choices' => array('Téléphone' => 'Téléphone', 'E-mail' => 'E-mail', 'Fax' => 'Fax', 'Courrier' => 'Courrier', 'SMS' => 'SMS', 'Oral' => 'Oral', 'Braille' => 'Braille', 'Signaux de fumée' => 'Signaux de fumée', 'Morse' => 'Morse', 'Uppercut' => 'Uppercut', 'Autre' => 'Autre'))),
      'date'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'objet'       => new sfValidatorPass(array('required' => false)),
      'commentaire' => new sfValidatorPass(array('required' => false)),
      'deleted_at'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'created_at'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('communication_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Communication';
  }

  public function getFields()
  {
    return array(
      'id'          => 'Number',
      'id_contact'  => 'ForeignKey',
      'id_groupe'   => 'ForeignKey',
      'type'        => 'Enum',
      'date'        => 'Date',
      'objet'       => 'Text',
      'commentaire' => 'Text',
      'deleted_at'  => 'Date',
      'created_at'  => 'Date',
      'updated_at'  => 'Date',
    );
  }
}
